/**
 * Created by wyz on 2018/5/21.
 */
import Router from "umi/router"
import 'babel-polyfill';
import Redirect from 'umi/redirect';
import 'fetch-detector';
import 'fetch-ie8';
import "../index.css"
import "../library/utils/surroundings/surroundings"
import { tools } from "dcloud-utils";

// 新打开页面时都要获取参数
tools.getOrderConfig(() => {
  if (!global.wx)
    tools.getConfig(() => {
      // 换完了再往下走
      global.wx = true;
      Router.replace('/main?t=' + Date.parse(new Date()));
    });
})
if (!localStorage.getItem("token")) {
  if (window.location.hash != '#/login/auth') {
    localStorage.setItem('refUrl', window.location.hash)
  }
  Router.push('/login/auth')
}

// 这里先进缓冲页，拿完初始化信息后再回到 /main
export default () => <Redirect to="/loding" />